---
title: WP API Documentation
---
<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width">

	<title>{{ page.title }}</title>

	<!-- Flatdoc -->
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
	<script src="https://cdn.rawgit.com/rstacruz/flatdoc/gh-pages/legacy.js"></script>
	<script src="https://cdn.rawgit.com/rstacruz/flatdoc/gh-pages/flatdoc.js"></script>

	<link rel="stylesheet" href="{{ site.baseurl }}stylesheets/styles.css">
	<link rel="stylesheet" href="{{ site.baseurl }}stylesheets/pygment_trac.css">

	<script src="https://cdn.rawgit.com/rstacruz/flatdoc/gh-pages/theme-white/script.js"></script>

	<!-- Meta -->
	<meta content="WP API" property="og:title">
	<meta content="Official Documentation for WP API" name="description">

	<!-- Initializer -->
	<script>
		var multi_github = function(multi) {
			var urls = [];
			var sort = {};
			for (var i = multi.length - 1; i >= 0; i--) {
				var bits = multi[i];
				var url = 'https://api.github.com/repos/'+bits.repo+'/contents/'+bits.filepath+'?ref=master';
				sort[bits.filepath] = i;

				urls.push(url);
			};
			return function(callback) {
				var requests = [];
				for (var i = urls.length - 1; i >= 0; i--) {
					requests.push($.get(urls[i]));
				};

				var promise = $.when.apply(null, requests);
				promise.fail(function(e) { callback(e, null); });
				promise.done(function(data) {
					var responses = Array.prototype.slice.call(arguments);
					responses.sort(function (a, b) {
						var a_path = a[0].path;
						var b_path = b[0].path;
						var a_index = sort[a_path];
						var b_index = sort[b_path];
						return b_index - a_index;
					})
					var markdown = '';
					for (var i = responses.length - 1; i >= 0; i--) {
						markdown += window.Base64.decode( responses[i][0].content );
					};
					callback(null, markdown);
				});
			};
		};
		function slugify(text) {
			return text.toLowerCase().match(/[a-z0-9]+/g).join('-');
		}
		Flatdoc.transformer.addIDs = function($content) {
			$content.find('h1, h2, h3').each(function() {
				var $el = $(this);
				var text = $el.text();
				var id = slugify(text);

				switch ($el[0].nodeName) {
					case 'H3':
						var text = $el.prevAll("h2").first().text();
						var id = slugify(text) + '_' + id;
						// Fall-through

					case 'H2':
						var text = $el.prevAll("h1").first().text();
						var id = slugify(text) + '_' + id;

				}
				$el.attr('id', id);
			});
		};
		Flatdoc.run({
			fetcher: multi_github([
				{ repo: "WP-API/WP-API", filepath: "README.md" },
				{ repo: "WP-API/WP-API", filepath: "docs/routes/routes.md" },
			])
		});
	</script>
</head>

{% include header.html %}

<div class="content-root">

{% include sidebar.html %}

	<div role="flatdoc-content" class="content"></div>
</div>

{% include footer.html %}
